/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * ventas_sie_diarioventas_detalle.java
 *
 * Created on 12/12/2011, 02:46:52 PM
 */

package sie_invdis;


import java.sql.*;
import javax.swing.*;

import javax.swing.JOptionPane;
import javax.swing.JTable;
import javax.swing.JTable.*;
import java.awt.*;
import java.awt.event.*;
import java.util.Date;
import java.util.Calendar;
import java.text.SimpleDateFormat;
import java.text.ParseException;
import java.text.*;
import javax.swing.JFrame;
import javax.swing.table.DefaultTableCellRenderer;
/**
 *
 * @author Michelle
 */
public class ventas_sie_diarioventas_detalle extends javax.swing.JFrame {

     private javax.swing.table.DefaultTableModel jtable_modelo;
     private javax.swing.table.DefaultTableModel jtable_modelo_movimientos;
     private javax.swing.table.DefaultTableModel jtable_modelo_detdev;
     DefaultTableCellRenderer alinearCentro, alinearderecha, alinearIzquierda;
    private SimpleDateFormat formateador = new SimpleDateFormat("dd-MM-yyyy");
    private SimpleDateFormat formateadoresta = new SimpleDateFormat("yyyy-MM-dd");
    //se crea intancia de la clase conexion
    bd_conexion x = new bd_conexion() ;
    String  textohtml="";
       //se creaa la variable resultset
    ResultSet rs = null;
    private int yacarguecanodev=0,indexactual=0;
    /** Creates new form ventas_sie_diarioventas_detalle */
    public ventas_sie_diarioventas_detalle() {
        initComponents();
    }
  public ventas_sie_diarioventas_detalle(int opcion,String idtienda,String idfolio,String tienda) {
      this.iniciar_modelo_detalle_pedido();
      this.iniciar_modelo_detalle_movimientos();
      this.iniciar_modelo_detalle_devolucion();
        initComponents();
       this.jtf_tienda.setText(idtienda+":"+tienda);
       this.jtf_folio.setText(idfolio);
       this.carga_datos_pedidoscatalogo(2,idtienda,idfolio, "");
       this.carga_datos_detalle(4, idtienda, idfolio);
       this.carga_datos_cobrosdetalle(1,idtienda,this.jtf_folioimpreso.getText(), "");

       jtbl_movimiento.getColumnModel().getColumn(0).setPreferredWidth(60);//tem ent
       jtbl_movimiento.getColumnModel().getColumn(1).setPreferredWidth(40);//familia
       jtbl_movimiento.getColumnModel().getColumn(2).setPreferredWidth(20);//subfam.
       jtbl_movimiento.getColumnModel().getColumn(3).setPreferredWidth(40);//tem ent

       this.setTitle("S.I. Diario Detalle("+this.jtf_cliente.getText()+")");
       this.carga_datos_fotospaginacion(0);
       this.centrar_datos();
    }

  private void iniciar_modelo_detalle_pedido()
    {
        jtable_modelo=new javax.swing.table.DefaultTableModel();//Creo el modelo
        jtable_modelo.addColumn("<html><b>Clave</b></html>");
        jtable_modelo.addColumn("<html><b>Descripcion</b></html>");
        jtable_modelo.addColumn("<html><b>Unidad</b></html>");
        jtable_modelo.addColumn("<html><b>Cant.</b></html>");
        jtable_modelo.addColumn("<html><b>Precio</b></html>");
        jtable_modelo.addColumn("<html><b>Desc</b></html>");
        jtable_modelo.addColumn("<html><b>Importe</b></html>");
        jtable_modelo.addColumn("<html><b>Promocion</b></html>");
    }
  private void iniciar_modelo_detalle_devolucion()
    {
        jtable_modelo_detdev=new javax.swing.table.DefaultTableModel();//Creo el modelo
        jtable_modelo_detdev.addColumn("<html><b>Clave</b></html>");
        jtable_modelo_detdev.addColumn("<html><b>Descripcion</b></html>");
        jtable_modelo_detdev.addColumn("<html><b>Item</b></html>");
        jtable_modelo_detdev.addColumn("<html><b>Un</b></html>");
        jtable_modelo_detdev.addColumn("<html><b>Cant.</b></html>");
    }
private void iniciar_modelo_detalle_movimientos()
    {
        jtable_modelo_movimientos=new javax.swing.table.DefaultTableModel();//Creo el modelo
        jtable_modelo_movimientos.addColumn("<html><b>Fecha</b></html>");
        jtable_modelo_movimientos.addColumn("<html><b>T/Pago</b></html>");
        jtable_modelo_movimientos.addColumn("<html><b>Imp.</b></html>");
        jtable_modelo_movimientos.addColumn("<html><b>Cajera</b></html>");
    }

    public void centrar_datos()
    {
        alinearderecha = new DefaultTableCellRenderer();
        alinearderecha.setHorizontalAlignment(SwingConstants.RIGHT);

                jtbl_detalleapartado.getColumnModel().getColumn(4).setCellRenderer(alinearderecha);
                jtbl_detalleapartado.getColumnModel().getColumn(6).setCellRenderer(alinearderecha);

    }

  private void carga_datos_pedidoscatalogo(int opcion,String tienda,String busca1,String busca2)
    {
       String fechacat = "",fechallegatienda="",fechaentrega="",abrehtml="",cierrahtml="";
       DecimalFormat miformat = new DecimalFormat("###,###,###,###");
       Object[] fnewRow = new Object[12];
       //invoco al metodo que trae el recordset de datos
       String texto="";
       //this.LimpiarJTable();
        try
         {
               texto="select * from x1venta_pedidos_completo("+opcion+",'"+tienda+"','"+busca1+"','"+busca2+"') as (idpedido integer,idnivel1 integer,totalventa real,idcatdes integer,idcliente integer,idstatus integer,totalventasindescuento real,descuento real,fechapedido date,horapedido time,idempleaagente integer,nombrestatus text,nombreagente text,apaternoagente text,nombrecliente text,idniv2 integer,horapago time,folioimpreso bigint,idempleadocaja integer,describedescuento text);";
               System.out.println(texto);
               rs = x.sieuno_executediversosv2(texto,variables_global.getconexiongral());
               while (rs.next())
                    {
                        //System.out.println(rs.getString("idtipopago"));
                    if(rs.getString("folioimpreso") != null)
                            {
                                this.jtf_folioimpreso.setText(rs.getString("folioimpreso"));

                                //fnewRow[11]=abrehtml+rs.getString("horapago").substring(0, 5)+cierrahtml;
                            }
                    else
                            {
                                this.jtf_folioimpreso.setText("");
                            }
                     this.jtf_status.setText(rs.getString("nombrestatus").toUpperCase());
                     //fnewRow[1]=abrehtml+rs.getString("idpedido")+cierrahtml;
                     this.jtf_fecha.setText(this.fechaeuropea(rs.getString("fechapedido"))+" "+rs.getString("horapedido").substring(0, 5));
                     //fnewRow[3]=abrehtml+rs.getString("horapedido").substring(0, 5)+cierrahtml;
                     this.jtf_cliente.setText(rs.getString("idcliente")+":"+rs.getString("nombrecliente"));
                     this.jtf_politicadesporcentaje.setText(miformat.format((rs.getFloat("descuento")/rs.getFloat("totalventasindescuento"))*100)+"%");
                     this.jtf_describepoliticadesc.setText(rs.getString("describedescuento"));
                     this.jtf_subtotal.setText(miformat.format(rs.getFloat("totalventasindescuento")));
                     this.jtf_total.setText(miformat.format(rs.getFloat("totalventa")));
                     this.jtf_descuento.setText(miformat.format(rs.getFloat("totalventasindescuento")-rs.getFloat("totalventa")));
                     this.jtf_agente.setText(rs.getString("idempleaagente")+":"+rs.getString("nombreagente").toUpperCase()+ " " +rs.getString("apaternoagente").toUpperCase());

                    }
        }
        catch(Exception e)
        {
            System.out.println(e.getMessage());
        }
     }
private void carga_datos_detalle(int opcion,String idtienda,String busca)
 {
        String fechacat = "",fechallegatienda="",fechaentrega="";
        DecimalFormat miformat = new DecimalFormat("###,###,###,###");
        java.util.Date fechahoy=new Date();

        Object[] fnewRow = new Object[8];
        float totpiezas=0;
       //invoco al metodo que trae el recordset de datos
       String arreglo_idtie[]=null,texto="select * from x1venta_pedidos_completo_detalle("+opcion+",'"+idtienda+"','"+busca+"','') as (idpedido integer,cns_detpet integer,piezas real,idalmpro integer,descuento real,precio real,idcatdes integer,iddetdes integer,idtipvent integer,importeprecioneto double precision,importepreciosindesc real,idproducto integer,claveproducto character varying(16),productodescribe character varying(80),ultimocosto numeric,familia integer,subfamilia integer,item character varying(80),temporadaingreso smallint,importecosto double precision,descpro text);";
        System.out.println(texto);
        try
         {
            rs = x.sieuno_executediversosv2(texto,variables_global.getconexiongral());
            while (rs.next())
                {
                    totpiezas+=rs.getFloat("piezas");
                    fnewRow[0]=rs.getString ("claveproducto");
                    fnewRow[1]=rs.getString ("productodescribe");
                    fnewRow[2]="PZ";
                    fnewRow[3]=miformat.format(rs.getFloat("piezas"));
                    fnewRow[4]=miformat.format(rs.getFloat("precio"));
                    fnewRow[5]=miformat.format((rs.getFloat("precio")*rs.getFloat("piezas"))-rs.getFloat("importeprecioneto"));
                    fnewRow[6]=miformat.format(rs.getFloat("importeprecioneto"));
                    fnewRow[7]=rs.getString ("descpro").toUpperCase();
                    jtable_modelo.addRow(fnewRow);
                }
        }
        catch(Exception e)
        {
            System.out.println(e.getMessage());
        }
       this.jtf_piezas.setText(miformat.format(totpiezas));
}


private void carga_datos_cobrosdetalle(int opcion,String tienda,String busca1,String busca2)
    {
       String fechacat = "",fechallegatienda="",fechaentrega="",abrehtml="",cierrahtml="";
        DecimalFormat miformat = new DecimalFormat("###,###,###,###");
        java.util.Date fechahoy=new Date();
        while(jtable_modelo_movimientos.getRowCount()>0)jtable_modelo_movimientos.removeRow(0);
        Object[] fnewRow = new Object[4];
       //invoco al metodo que trae el recordset de datos
       String texto="";
       //this.LimpiarJTable();
        try
         {
               texto="select * from x1venta_cobros_detallev2("+opcion+",'"+tienda+"','"+busca1+"','"+busca2+"') as (idremision integer,idtipopago integer,cantidad double precision,cantidadpesos double precision,idniv2 integer,fecha date,hora time,idniv1 integer,folioimpreso bigint,idempleacobra integer,nombretipopago character varying(15),nombrecajero text,apaternocajero text,idpedido integer,totalventa real,idcliente integer);";
               System.out.println(texto);
               rs = x.sieuno_executediversosv2(texto,variables_global.getconexiongral());
               while (rs.next())
                    {
                    System.out.println(rs.getString("idtipopago"));

                        switch (rs.getInt("idtipopago"))
                        {
                            case 0:
                                abrehtml="<html><font color=#0000FF>";
                                cierrahtml="<font></html>";
                            break;
                            case 5:
                                 abrehtml="<html><font color=#0000FF>";
                                 cierrahtml="<font></html>";
                            break;
                            default:
                                 abrehtml="<html>";
                                 cierrahtml="</html>";
                            break;
                        }
                     this.jtf_folioremision.setText(rs.getString("idniv2"));
                     fnewRow[0]=abrehtml+this.fechaeuropea(rs.getString("fecha"))+" "+rs.getString("hora").substring(0, 5)+cierrahtml;
                     fnewRow[1]=abrehtml+rs.getString("idtipopago")+":"+rs.getString("nombretipopago").toUpperCase()+cierrahtml;
                     fnewRow[2]=abrehtml+miformat.format(rs.getFloat("cantidadpesos"))+cierrahtml;
                     fnewRow[3]=abrehtml+rs.getString("nombrecajero")+" "+rs.getString("apaternocajero")+cierrahtml;
                     jtable_modelo_movimientos.addRow(fnewRow);
                    }
        }
        catch(Exception e)
        {
            System.out.println(e.getMessage());
        }
       //cancelaciones

     }

private void carga_datos_cobros_canydev(int opcion,String tienda,String busca1,String busca2)
    {
       String fechacat = "",fechallegatienda="",fechaentrega="",abrehtml="",cierrahtml="";
        DecimalFormat miformat = new DecimalFormat("###,###,###,###");
        java.util.Date fechahoy=new Date();
       
        Object[] fnewRow = new Object[4];
       //invoco al metodo que trae el recordset de datos
       String texto="";
       //this.LimpiarJTable();
               //cancelaciones
        try
         {
               texto="select * from x1venta_cobros_detalle_cancelaciones("+opcion+",'"+tienda+"','"+busca1+"','"+busca2+"') as (idcancelacion integer,idniv3 integer,razon text,pesosomonedero integer,fechacancela date,horacancela time with time zone,idempleacancela integer,idniv2 integer,foliocancela integer,idremision integer,idtipopago integer,cantidad double precision,cantidadpesos double precision,fechacobro date,horacobro time,folioimpreso bigint,idempleacobra integer,nombretipopago character varying(15),nombrecajero text,apaternocajero text,idpedido integer,totalventa real,idcliente integer);";
               System.out.println(texto);
               rs = x.sieuno_executediversosv2(texto,variables_global.getconexiongral());
               while (rs.next())
                    {
                        System.out.println(rs.getString("idtipopago"));
                        switch (rs.getInt("idtipopago"))
                        {
                            default:
                                 abrehtml="<html><font color=#CC0000>";
                                 cierrahtml="<font></html>";
                            break;
                        }
                         switch (rs.getInt("pesosomonedero"))
                        {
                            case 0:
                                fnewRow[1]=abrehtml+"0"+":"+"Error Cancelacion"+cierrahtml;
                            break;
                            case 1:
                                fnewRow[1]=abrehtml+"1"+":"+"EFECTIVO"+cierrahtml;
                            break;
                            case 2:
                                fnewRow[1]=abrehtml+"5"+":"+"MONEDERO"+cierrahtml;
                            break;
                            default:
                                fnewRow[1]=abrehtml+"1"+":"+"EFECTIVO"+cierrahtml;
                            break;
                        }
                     fnewRow[0]=abrehtml+this.fechaeuropea(rs.getString("fechacancela"))+" "+rs.getString("horacancela").substring(0, 5)+cierrahtml;
                     //fnewRow[1]=abrehtml+rs.getString("idtipopago")+":"+rs.getString("nombretipopago").toUpperCase()+cierrahtml;
                     fnewRow[2]=abrehtml+miformat.format(rs.getFloat("cantidadpesos"))+cierrahtml;
                     fnewRow[3]=abrehtml+rs.getString("nombrecajero")+" "+rs.getString("apaternocajero")+cierrahtml;
                     this.jep_razon.setText(rs.getString("razon"));
                     jtable_modelo_movimientos.addRow(fnewRow);
                    }
        }
        catch(Exception e)
        {
            System.out.println(e.getMessage());
        }
    //devoluciones
    try
         {
               texto="select * from x1venta_cobros_detalle_devoluciones("+opcion+",'"+tienda+"','"+busca1+"','"+busca2+"') as (iddevolucion integer,idniv3 integer,razondevolu text,idremisiondevuelta integer,cantidaddevuelta double precision,pesosomonedero integer,fechadev date,horadev time with time zone,idempleado integer,idniv2 integer,folioniv3 integer,idpedido integer,idniv1 integer,totalventa real,idcatdes integer,idcliente integer,idstatus integer,totalventasindesc real,descuento real,fechaventa date,horaventa time,idempleaagente integer,nombrestatus text,nombreagente text,apaternoagente text,nombrecliente text,horapago time,folioimpreso bigint,idempleacaja integer,describepromocionventa text);";
               System.out.println(texto);
               rs = x.sieuno_executediversosv2(texto,variables_global.getconexiongral());
               while (rs.next())
                    {
                     System.out.println(rs.getString("pesosomonedero"));
                        switch (rs.getInt("pesosomonedero"))
                        {
                            case 2:
                                    fnewRow[1]=abrehtml+"1"+":"+"EFECTIVO"+cierrahtml;
                            break;
                            default:
                                    fnewRow[1]=abrehtml+"0"+":"+"NO ESPECIFICADO"+cierrahtml;
                            break;
                        }
                     abrehtml="<html><font color=#CC0000>";
                     cierrahtml="<font></html>";
                     this.jtf_iddevolucion.setText(rs.getString("iddevolucion"));
                     fnewRow[0]=abrehtml+this.fechaeuropea(rs.getString("fechadev"))+" "+rs.getString("horadev").substring(0, 5)+cierrahtml;
                     fnewRow[2]=abrehtml+miformat.format(rs.getFloat("cantidaddevuelta"))+cierrahtml;
                     fnewRow[3]="";
                     this.jep_razon.setText(rs.getString("razondevolu"));
                     jtable_modelo_movimientos.addRow(fnewRow);
                    }
        }
        catch(Exception e)
        {
            System.out.println(e.getMessage());
        }



     }
private void carga_datos_detalledevolucion(int opcion,String idtienda,String busca)
 {
        String fechacat = "",fechallegatienda="",fechaentrega="";
        DecimalFormat miformat = new DecimalFormat("###,###,###,###");
        java.util.Date fechahoy=new Date();

        Object[] fnewRow = new Object[5];
        float totpiezas=0;
       //invoco al metodo que trae el recordset de datos
       String arreglo_idtie[]=null;

        try
         {
            rs = x.sieuno_executediversosv2("select * from x1venta_diario_devolucion_detalle("+opcion+",'"+idtienda+"','"+busca+"','') as (iddevolucion integer,cnsdetdev integer,cantidaddev integer,idalmpro integer,idproducto integer,claveproducto character varying(16),descripcion character varying(80),ultimocosto numeric,familia integer,subfamilia integer,item character varying(80),tempoingreso smallint);",variables_global.getconexiongral());
            while (rs.next())
                {
                    fnewRow[0]=rs.getString ("claveproducto");
                    fnewRow[1]=rs.getString ("descripcion");
                    fnewRow[2]=rs.getString ("item");
                    fnewRow[3]="PZ";
                    fnewRow[4]=miformat.format(rs.getFloat("cantidaddev"));

                    jtable_modelo_detdev.addRow(fnewRow);
                }
        }
        catch(Exception e)
        {
            System.out.println(e.getMessage());
        }

}

  private void carga_datos_fotospaginacion(int pagina)
    {
        textohtml="";
        int nif=0,pag=pagina,nobjetotabla=this.jtable_modelo.getRowCount(),nip=0,ni=0,fila=0,artxpag=Integer.valueOf(this.jtf_fotosartxpag1.getText().toString());
        float totalpaginas=this.jtable_modelo.getRowCount()/artxpag;

        this.jlbl_paginas2.setText("PAGINAS :"+totalpaginas);
             nif=((pag+1)*artxpag);
             nip=((pag)*artxpag);
                        if (nif < nobjetotabla )
                            {
                                nobjetotabla=nif;
                            }
                    System.out.println("filas x pagina"+artxpag+"tOTAL FILAS:"+this.jtable_modelo.getRowCount()+" PAGINA ACTUAL "+pagina+" filainicial "+ nip + " Fila Final"+ nobjetotabla);
                    /*Impresion de los productos*/
                        for(ni=nip;ni<nobjetotabla;ni++)
                        {
                            System.out.println(" fila Actual "+ ni );
                                if (fila<=0)
                                    {
                                    	textohtml+= "<tr>";
                                    }
                                    fila++;
                                    textohtml+="<th>"+jtable_modelo.getValueAt(ni, 0).toString()+"<br>"+jtable_modelo.getValueAt(ni, 1).toString() + " $"+jtable_modelo.getValueAt(ni, 4).toString()+ "<br>"+"<img src=\"http://"+variables_global.getHostfotos()+"/"+variables_global.getcarpetaaplicacion()+"/fotos/"+jtable_modelo.getValueAt(ni, 0).toString()+".JPG\" width=230 height=190 border=0 alt=\"Foto Articulo\" />"+"</th>";
                                 if (fila>=4)
                                    {
                                        textohtml+= "</tr>";
                                        fila=0;
                                    }
                        }
         this.jepn_fotos.setText("<html><head></head><body><table>"+textohtml+"</table></body></html>");
         System.out.println(" este es html "+ textohtml );
    }


  private String  fechaeuropea(String fecha) {

         //resibe cadena de fecha en formato americano yyyy-MM-dd
        java.util.Date fechaestaeuropa=null;
       SimpleDateFormat formateadorestaeuropa = new SimpleDateFormat("dd-MM-yyyy");
       String cadenafecha="";
        try
         {
          fechaestaeuropa = formateadoresta.parse(fecha);
         }
        catch (ParseException e)
          {
             //Error, la cadena de texto no se puede convertir en fecha.
          }
       cadenafecha= formateadorestaeuropa.format(fechaestaeuropa);
       return cadenafecha;

    }
 private String DiaSemana(String fe) {
         String dia = "";
       java.util.Date fecha=null;
         try
            {
             fecha = formateador.parse(fe);

           }
        catch (ParseException e)
            {
            //Error, la cadena de texto no se puede convertir en fecha.
            }
        Calendar cal= Calendar.getInstance();
        cal.setTime(fecha);
        //ojo para establecer o recetear cada parte de la fecha por separado
        //cal.set(Calendar.YEAR, fecha.getYear());
        //cal.set(Calendar.MONTH, fecha.getMonth());
        //cal.set(Calendar.DAY_OF_MONTH, fecha.getDay());
        int diaInt = cal.get(Calendar.DAY_OF_WEEK);
        switch (diaInt) {
            case 1:
                dia = "Domingo";
                break;
            case 2:
                dia = "Lunes";
                break;
            case 3:
                dia = "Martes";
                break;
            case 4:
                dia = "Miercoles";
                break;
            case 5:
                dia = "Jueves";
                break;
            case 6:
                dia = "Viernes";
                break;
            case 7:
                dia = "Sabado";
                break;

        }
        return dia;
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel2 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jtf_tienda = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        jtf_status = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        jtf_folioimpreso = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        jtf_folio = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        jtf_cliente = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        jtf_direccion = new javax.swing.JTextField();
        jLabel7 = new javax.swing.JLabel();
        jtf_telefono = new javax.swing.JTextField();
        jtf_fecha = new javax.swing.JTextField();
        jLabel8 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        jtf_describepoliticadesc = new javax.swing.JTextField();
        jLabel13 = new javax.swing.JLabel();
        jtf_politicadesporcentaje = new javax.swing.JTextField();
        jLabel14 = new javax.swing.JLabel();
        jtf_agente = new javax.swing.JTextField();
        jtbn_clietestadistica = new javax.swing.JButton();
        jtf_folioremision = new javax.swing.JTextField();
        jLabel16 = new javax.swing.JLabel();
        jPanel3 = new javax.swing.JPanel();
        jScrollPane2 = new javax.swing.JScrollPane();
        jtbl_movimiento = new javax.swing.JTable();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel1 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jtbl_detalleapartado = new javax.swing.JTable()
        {
            public boolean isCellEditable(int rowIndex, int mColIndex) {
                return false;
            }}
            ;
            jtf_subtotal = new javax.swing.JTextField();
            jLabel10 = new javax.swing.JLabel();
            jtf_descuento = new javax.swing.JTextField();
            jLabel11 = new javax.swing.JLabel();
            jtf_total = new javax.swing.JTextField();
            jLabel9 = new javax.swing.JLabel();
            jLabel15 = new javax.swing.JLabel();
            jtf_piezas = new javax.swing.JTextField();
            jPanel4 = new javax.swing.JPanel();
            jScrollPane3 = new javax.swing.JScrollPane();
            jtbl_detalledevolucion = new javax.swing.JTable()
            {
                public boolean isCellEditable(int rowIndex, int mColIndex) {
                    return false;
                }}
                ;
                jLabel17 = new javax.swing.JLabel();
                jtf_iddevolucion = new javax.swing.JTextField();
                jScrollPane4 = new javax.swing.JScrollPane();
                jep_razon = new javax.swing.JEditorPane();
                jLabel18 = new javax.swing.JLabel();
                jPanel5 = new javax.swing.JPanel();
                jScrollPane6 = new javax.swing.JScrollPane();
                jepn_fotos = new javax.swing.JEditorPane();
                jtf_fotosartxpag1 = new javax.swing.JTextField();
                jlbl_paginas2 = new javax.swing.JLabel();
                jbtn_anterior1 = new javax.swing.JButton();
                jtf_paginaactual1 = new javax.swing.JTextField();
                jbtn_siguiente1 = new javax.swing.JButton();
                jMenuBar1 = new javax.swing.JMenuBar();
                jMenu1 = new javax.swing.JMenu();
                jmni_salir = new javax.swing.JMenuItem();
                jMenu2 = new javax.swing.JMenu();
                jmni_escape = new javax.swing.JMenuItem();

                setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
                setName("Form"); // NOI18N

                org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(sie_invdis.Sie_invdisApp.class).getContext().getResourceMap(ventas_sie_diarioventas_detalle.class);
                jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPanel2.border.title"))); // NOI18N
                jPanel2.setName("jPanel2"); // NOI18N

                jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
                jLabel1.setName("jLabel1"); // NOI18N

                jtf_tienda.setEditable(false);
                jtf_tienda.setName("jtf_tienda"); // NOI18N

                jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N
                jLabel2.setName("jLabel2"); // NOI18N

                jtf_status.setEditable(false);
                jtf_status.setName("jtf_status"); // NOI18N

                jLabel3.setText(resourceMap.getString("jLabel3.text")); // NOI18N
                jLabel3.setName("jLabel3"); // NOI18N

                jtf_folioimpreso.setEditable(false);
                jtf_folioimpreso.setName("jtf_folioimpreso"); // NOI18N

                jLabel4.setText(resourceMap.getString("jLabel4.text")); // NOI18N
                jLabel4.setName("jLabel4"); // NOI18N

                jtf_folio.setEditable(false);
                jtf_folio.setName("jtf_folio"); // NOI18N

                jLabel5.setText(resourceMap.getString("jLabel5.text")); // NOI18N
                jLabel5.setName("jLabel5"); // NOI18N

                jtf_cliente.setEditable(false);
                jtf_cliente.setName("jtf_cliente"); // NOI18N

                jLabel6.setText(resourceMap.getString("jLabel6.text")); // NOI18N
                jLabel6.setName("jLabel6"); // NOI18N

                jtf_direccion.setEditable(false);
                jtf_direccion.setName("jtf_direccion"); // NOI18N

                jLabel7.setText(resourceMap.getString("jLabel7.text")); // NOI18N
                jLabel7.setName("jLabel7"); // NOI18N

                jtf_telefono.setEditable(false);
                jtf_telefono.setName("jtf_telefono"); // NOI18N

                jtf_fecha.setEditable(false);
                jtf_fecha.setName("jtf_fecha"); // NOI18N

                jLabel8.setText(resourceMap.getString("jLabel8.text")); // NOI18N
                jLabel8.setName("jLabel8"); // NOI18N

                jLabel12.setText(resourceMap.getString("jLabel12.text")); // NOI18N
                jLabel12.setName("jLabel12"); // NOI18N

                jtf_describepoliticadesc.setEditable(false);
                jtf_describepoliticadesc.setName("jtf_describepoliticadesc"); // NOI18N

                jLabel13.setText(resourceMap.getString("jLabel13.text")); // NOI18N
                jLabel13.setName("jLabel13"); // NOI18N

                jtf_politicadesporcentaje.setEditable(false);
                jtf_politicadesporcentaje.setName("jtf_politicadesporcentaje"); // NOI18N

                jLabel14.setText(resourceMap.getString("jLabel14.text")); // NOI18N
                jLabel14.setName("jLabel14"); // NOI18N

                jtf_agente.setEditable(false);
                jtf_agente.setName("jtf_agente"); // NOI18N

                jtbn_clietestadistica.setIcon(resourceMap.getIcon("jtbn_clietestadistica.icon")); // NOI18N
                jtbn_clietestadistica.setText(resourceMap.getString("jtbn_clietestadistica.text")); // NOI18N
                jtbn_clietestadistica.setToolTipText(resourceMap.getString("jtbn_clietestadistica.toolTipText")); // NOI18N
                jtbn_clietestadistica.setName("jtbn_clietestadistica"); // NOI18N
                jtbn_clietestadistica.addActionListener(new java.awt.event.ActionListener() {
                    public void actionPerformed(java.awt.event.ActionEvent evt) {
                        jtbn_clietestadisticaActionPerformed(evt);
                    }
                });

                jtf_folioremision.setEditable(false);
                jtf_folioremision.setName("jtf_folioremision"); // NOI18N

                jLabel16.setText(resourceMap.getString("jLabel16.text")); // NOI18N
                jLabel16.setName("jLabel16"); // NOI18N

                javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
                jPanel2.setLayout(jPanel2Layout);
                jPanel2Layout.setHorizontalGroup(
                    jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addGroup(jPanel2Layout.createSequentialGroup()
                                        .addComponent(jLabel1)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jtf_tienda, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jLabel8)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jtf_fecha, javax.swing.GroupLayout.PREFERRED_SIZE, 179, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGroup(jPanel2Layout.createSequentialGroup()
                                        .addComponent(jLabel4)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jtf_folio, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jLabel3)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jtf_folioimpreso)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jLabel16)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jtf_folioremision, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(jPanel2Layout.createSequentialGroup()
                                        .addComponent(jLabel14)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jtf_agente, javax.swing.GroupLayout.DEFAULT_SIZE, 205, Short.MAX_VALUE))
                                    .addGroup(jPanel2Layout.createSequentialGroup()
                                        .addComponent(jLabel2)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jtf_status, javax.swing.GroupLayout.DEFAULT_SIZE, 209, Short.MAX_VALUE))))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                                .addContainerGap()
                                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addGroup(jPanel2Layout.createSequentialGroup()
                                        .addComponent(jLabel7)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jtf_telefono, javax.swing.GroupLayout.DEFAULT_SIZE, 291, Short.MAX_VALUE))
                                    .addGroup(jPanel2Layout.createSequentialGroup()
                                        .addComponent(jLabel5)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jtf_cliente, javax.swing.GroupLayout.DEFAULT_SIZE, 233, Short.MAX_VALUE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jtbn_clietestadistica)))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel6)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jtf_direccion, javax.swing.GroupLayout.PREFERRED_SIZE, 205, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addContainerGap()
                                .addComponent(jLabel12)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jtf_describepoliticadesc, javax.swing.GroupLayout.PREFERRED_SIZE, 215, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel13)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jtf_politicadesporcentaje, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addContainerGap())
                );
                jPanel2Layout.setVerticalGroup(
                    jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel1)
                            .addComponent(jtf_status, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jtf_tienda, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel2)
                            .addComponent(jtf_fecha, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel8))
                        .addGap(9, 9, 9)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel4)
                            .addComponent(jtf_folio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel3)
                            .addComponent(jtf_folioimpreso, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jtf_agente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel14)
                            .addComponent(jtf_folioremision, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel16))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel5)
                            .addComponent(jtf_cliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jtbn_clietestadistica)
                            .addComponent(jtf_direccion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel6))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel7)
                            .addComponent(jtf_telefono, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jtf_describepoliticadesc, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel12)
                            .addComponent(jLabel13)
                            .addComponent(jtf_politicadesporcentaje, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                );

                jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPanel3.border.title"))); // NOI18N
                jPanel3.setName("jPanel3"); // NOI18N

                jScrollPane2.setName("jScrollPane2"); // NOI18N

                jtbl_movimiento.setModel(this.jtable_modelo_movimientos);
                jtbl_movimiento.setName("jtbl_movimiento"); // NOI18N
                jScrollPane2.setViewportView(jtbl_movimiento);

                javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
                jPanel3.setLayout(jPanel3Layout);
                jPanel3Layout.setHorizontalGroup(
                    jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 265, Short.MAX_VALUE)
                );
                jPanel3Layout.setVerticalGroup(
                    jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 132, Short.MAX_VALUE)
                );

                jTabbedPane1.setName("jTabbedPane1"); // NOI18N
                jTabbedPane1.addChangeListener(new javax.swing.event.ChangeListener() {
                    public void stateChanged(javax.swing.event.ChangeEvent evt) {
                        jTabbedPane1StateChanged(evt);
                    }
                });

                jPanel1.setName("jPanel1"); // NOI18N

                jScrollPane1.setName("jScrollPane1"); // NOI18N

                jtbl_detalleapartado.setModel(this.jtable_modelo);
                jtbl_detalleapartado.setName("jtbl_detalleapartado"); // NOI18N
                jScrollPane1.setViewportView(jtbl_detalleapartado);

                jtf_subtotal.setEditable(false);
                jtf_subtotal.setFont(resourceMap.getFont("jtf_subtotal.font")); // NOI18N
                jtf_subtotal.setName("jtf_subtotal"); // NOI18N

                jLabel10.setText(resourceMap.getString("jLabel10.text")); // NOI18N
                jLabel10.setName("jLabel10"); // NOI18N

                jtf_descuento.setEditable(false);
                jtf_descuento.setFont(resourceMap.getFont("jtf_descuento.font")); // NOI18N
                jtf_descuento.setName("jtf_descuento"); // NOI18N

                jLabel11.setText(resourceMap.getString("jLabel11.text")); // NOI18N
                jLabel11.setName("jLabel11"); // NOI18N

                jtf_total.setEditable(false);
                jtf_total.setFont(resourceMap.getFont("jtf_total.font")); // NOI18N
                jtf_total.setName("jtf_total"); // NOI18N

                jLabel9.setText(resourceMap.getString("jLabel9.text")); // NOI18N
                jLabel9.setName("jLabel9"); // NOI18N

                jLabel15.setText(resourceMap.getString("jLabel15.text")); // NOI18N
                jLabel15.setName("jLabel15"); // NOI18N

                jtf_piezas.setEditable(false);
                jtf_piezas.setFont(resourceMap.getFont("jtf_piezas.font")); // NOI18N
                jtf_piezas.setName("jtf_piezas"); // NOI18N

                javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
                jPanel1.setLayout(jPanel1Layout);
                jPanel1Layout.setHorizontalGroup(
                    jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 907, Short.MAX_VALUE)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addContainerGap(285, Short.MAX_VALUE)
                                .addComponent(jLabel15)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jtf_piezas, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(76, 76, 76)
                                .addComponent(jLabel9)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(jtf_subtotal, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel10)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jtf_descuento, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel11)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jtf_total, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addContainerGap())
                );
                jPanel1Layout.setVerticalGroup(
                    jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 309, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jtf_subtotal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel10)
                            .addComponent(jtf_descuento, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel11)
                            .addComponent(jtf_total, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel9)
                            .addComponent(jLabel15)
                            .addComponent(jtf_piezas, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addContainerGap())
                );

                jTabbedPane1.addTab(resourceMap.getString("jPanel1.TabConstraints.tabTitle"), jPanel1); // NOI18N

                jPanel4.setName("jPanel4"); // NOI18N

                jScrollPane3.setName("jScrollPane3"); // NOI18N

                jtbl_detalledevolucion.setModel(this.jtable_modelo_detdev);
                jtbl_detalledevolucion.setName("jtbl_detalledevolucion"); // NOI18N
                jScrollPane3.setViewportView(jtbl_detalledevolucion);

                jLabel17.setText(resourceMap.getString("jLabel17.text")); // NOI18N
                jLabel17.setName("jLabel17"); // NOI18N

                jtf_iddevolucion.setEditable(false);
                jtf_iddevolucion.setText(resourceMap.getString("jtf_iddevolucion.text")); // NOI18N
                jtf_iddevolucion.setName("jtf_iddevolucion"); // NOI18N

                jScrollPane4.setName("jScrollPane4"); // NOI18N

                jep_razon.setName("jep_razon"); // NOI18N
                jScrollPane4.setViewportView(jep_razon);

                jLabel18.setText(resourceMap.getString("jLabel18.text")); // NOI18N
                jLabel18.setName("jLabel18"); // NOI18N

                javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
                jPanel4.setLayout(jPanel4Layout);
                jPanel4Layout.setHorizontalGroup(
                    jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabel17)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jtf_iddevolucion, javax.swing.GroupLayout.PREFERRED_SIZE, 56, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jLabel18)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 755, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap(22, Short.MAX_VALUE))
                    .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel4Layout.createSequentialGroup()
                            .addGap(5, 5, 5)
                            .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 907, Short.MAX_VALUE)
                            .addGap(5, 5, 5)))
                );
                jPanel4Layout.setVerticalGroup(
                    jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel17)
                                .addComponent(jtf_iddevolucion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jLabel18)))
                        .addContainerGap(326, Short.MAX_VALUE))
                    .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel4Layout.createSequentialGroup()
                            .addGap(44, 44, 44)
                            .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 219, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addContainerGap(96, Short.MAX_VALUE)))
                );

                jTabbedPane1.addTab(resourceMap.getString("jPanel4.TabConstraints.tabTitle"), jPanel4); // NOI18N

                jPanel5.setName("jPanel5"); // NOI18N

                jScrollPane6.setName("jScrollPane6"); // NOI18N

                jepn_fotos.setContentType(resourceMap.getString("jepn_fotos.contentType")); // NOI18N
                jepn_fotos.setName("jepn_fotos"); // NOI18N
                jScrollPane6.setViewportView(jepn_fotos);

                jtf_fotosartxpag1.setText(resourceMap.getString("jtf_fotosartxpag1.text")); // NOI18N
                jtf_fotosartxpag1.setToolTipText(resourceMap.getString("jtf_fotosartxpag1.toolTipText")); // NOI18N
                jtf_fotosartxpag1.setName("jtf_fotosartxpag1"); // NOI18N
                jtf_fotosartxpag1.addActionListener(new java.awt.event.ActionListener() {
                    public void actionPerformed(java.awt.event.ActionEvent evt) {
                        jtf_fotosartxpag1ActionPerformed(evt);
                    }
                });

                jlbl_paginas2.setText(resourceMap.getString("jlbl_paginas2.text")); // NOI18N
                jlbl_paginas2.setName("jlbl_paginas2"); // NOI18N

                jbtn_anterior1.setText(resourceMap.getString("jbtn_anterior1.text")); // NOI18N
                jbtn_anterior1.setName("jbtn_anterior1"); // NOI18N
                jbtn_anterior1.addActionListener(new java.awt.event.ActionListener() {
                    public void actionPerformed(java.awt.event.ActionEvent evt) {
                        jbtn_anterior1ActionPerformed(evt);
                    }
                });

                jtf_paginaactual1.setText(resourceMap.getString("jtf_paginaactual1.text")); // NOI18N
                jtf_paginaactual1.setName("jtf_paginaactual1"); // NOI18N
                jtf_paginaactual1.addActionListener(new java.awt.event.ActionListener() {
                    public void actionPerformed(java.awt.event.ActionEvent evt) {
                        jtf_paginaactual1ActionPerformed(evt);
                    }
                });

                jbtn_siguiente1.setText(resourceMap.getString("jbtn_siguiente1.text")); // NOI18N
                jbtn_siguiente1.setName("jbtn_siguiente1"); // NOI18N
                jbtn_siguiente1.addActionListener(new java.awt.event.ActionListener() {
                    public void actionPerformed(java.awt.event.ActionEvent evt) {
                        jbtn_siguiente1ActionPerformed(evt);
                    }
                });

                javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
                jPanel5.setLayout(jPanel5Layout);
                jPanel5Layout.setHorizontalGroup(
                    jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup()
                        .addContainerGap(311, Short.MAX_VALUE)
                        .addComponent(jtf_fotosartxpag1, javax.swing.GroupLayout.PREFERRED_SIZE, 56, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(50, 50, 50)
                        .addComponent(jlbl_paginas2)
                        .addGap(27, 27, 27)
                        .addComponent(jbtn_anterior1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jtf_paginaactual1, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jbtn_siguiente1)
                        .addGap(229, 229, 229))
                    .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel5Layout.createSequentialGroup()
                            .addComponent(jScrollPane6, javax.swing.GroupLayout.DEFAULT_SIZE, 907, Short.MAX_VALUE)
                            .addContainerGap()))
                );
                jPanel5Layout.setVerticalGroup(
                    jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup()
                        .addContainerGap(325, Short.MAX_VALUE)
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jlbl_paginas2)
                            .addComponent(jbtn_anterior1)
                            .addComponent(jbtn_siguiente1)
                            .addComponent(jtf_paginaactual1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jtf_fotosartxpag1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addContainerGap())
                    .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel5Layout.createSequentialGroup()
                            .addGap(7, 7, 7)
                            .addComponent(jScrollPane6, javax.swing.GroupLayout.PREFERRED_SIZE, 303, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addContainerGap(49, Short.MAX_VALUE)))
                );

                jTabbedPane1.addTab(resourceMap.getString("jPanel5.TabConstraints.tabTitle"), jPanel5); // NOI18N

                jMenuBar1.setName("jMenuBar1"); // NOI18N

                jMenu1.setText(resourceMap.getString("jMenu1.text")); // NOI18N
                jMenu1.setName("jMenu1"); // NOI18N

                jmni_salir.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.ALT_MASK));
                jmni_salir.setIcon(resourceMap.getIcon("jmni_salir.icon")); // NOI18N
                jmni_salir.setText(resourceMap.getString("jmni_salir.text")); // NOI18N
                jmni_salir.setName("jmni_salir"); // NOI18N
                jmni_salir.addActionListener(new java.awt.event.ActionListener() {
                    public void actionPerformed(java.awt.event.ActionEvent evt) {
                        jmni_salirActionPerformed(evt);
                    }
                });
                jMenu1.add(jmni_salir);

                jMenuBar1.add(jMenu1);

                jMenu2.setText(resourceMap.getString("jMenu2.text")); // NOI18N
                jMenu2.setName("jMenu2"); // NOI18N

                jmni_escape.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_ESCAPE, 0));
                jmni_escape.setText(resourceMap.getString("jmni_escape.text")); // NOI18N
                jmni_escape.setName("jmni_escape"); // NOI18N
                jmni_escape.addActionListener(new java.awt.event.ActionListener() {
                    public void actionPerformed(java.awt.event.ActionEvent evt) {
                        jmni_escapeActionPerformed(evt);
                    }
                });
                jMenu2.add(jmni_escape);

                jMenuBar1.add(jMenu2);

                setJMenuBar(jMenuBar1);

                javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
                getContentPane().setLayout(layout);
                layout.setHorizontalGroup(
                    layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 922, Short.MAX_VALUE)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                        .addContainerGap())
                );
                layout.setVerticalGroup(
                    layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jTabbedPane1))
                );

                pack();
            }// </editor-fold>//GEN-END:initComponents

    private void jmni_salirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmni_salirActionPerformed
        // TODO add your handling code here:
    if(JOptionPane.showConfirmDialog(null, "Desea Salir?")==0) {
             this.dispose();
        }
    }//GEN-LAST:event_jmni_salirActionPerformed

    private void jmni_escapeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmni_escapeActionPerformed
        // TODO add your handling code here:
       this.jmni_salirActionPerformed(evt);
    }//GEN-LAST:event_jmni_escapeActionPerformed

    private void jtbn_clietestadisticaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtbn_clietestadisticaActionPerformed
        // TODO add your handling code here:
       String idcliente[]=jtf_cliente.getText().split(":") ;
       if(Integer.valueOf(idcliente[0])>0)
            {
        //JFrame mainFrame = Sie_invdisApp.getApplication().getMainFrame();
                monedero_sie_catalogo_detalle fmscd=new monedero_sie_catalogo_detalle("",idcliente[0]);
                fmscd.pack();
                fmscd.setVisible(true);
            }
}//GEN-LAST:event_jtbn_clietestadisticaActionPerformed

    private void jTabbedPane1StateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jTabbedPane1StateChanged
        // TODO add your handling code here:
           indexactual=this.jTabbedPane1.getSelectedIndex();
          if((indexactual==1)&&(yacarguecanodev==0))
                {
                   yacarguecanodev=1;
                   String a_tiendas[]=this.jtf_tienda.getText().toString().split(":");
                   //this.carga_datos_cobrosxtienda(0, "0",this.fechaamericana(this.jdc_fechainicial.getDate()),this.fechaamericana(this.jdc_fechafinal.getDate()));
                    this.carga_datos_cobros_canydev(1,a_tiendas[0],this.jtf_folio.getText(),"");
                    if(Integer.valueOf(this.jtf_iddevolucion.getText())>0)
                             {
                                this.carga_datos_detalledevolucion(0,a_tiendas[0],this.jtf_iddevolucion.getText());
                             }

                }
    }//GEN-LAST:event_jTabbedPane1StateChanged

    private void jtf_fotosartxpag1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_fotosartxpag1ActionPerformed
        // TODO add your handling code here:
        this.carga_datos_fotospaginacion(Integer.valueOf(this.jtf_paginaactual1.getText().toString()));
}//GEN-LAST:event_jtf_fotosartxpag1ActionPerformed

    private void jbtn_anterior1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_anterior1ActionPerformed
        // TODO add your handling code here:
        this.jtf_paginaactual1.setText(String.valueOf(Integer.valueOf(this.jtf_paginaactual1.getText().toString())-1));
        System.out.println("Esta es la pagina que mando"+this.jtf_paginaactual1.getText());
        this.carga_datos_fotospaginacion(Integer.valueOf(this.jtf_paginaactual1.getText().toString()));
}//GEN-LAST:event_jbtn_anterior1ActionPerformed

    private void jtf_paginaactual1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_paginaactual1ActionPerformed
        // TODO add your handling code here:
        this.carga_datos_fotospaginacion(Integer.valueOf(this.jtf_paginaactual1.getText().toString()));
}//GEN-LAST:event_jtf_paginaactual1ActionPerformed

    private void jbtn_siguiente1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_siguiente1ActionPerformed
        // TODO add your handling code here:
        this.jtf_paginaactual1.setText(String.valueOf(Integer.valueOf(this.jtf_paginaactual1.getText().toString())+1));
        System.out.println("Esta es la pagina que mando"+this.jtf_paginaactual1.getText());
        this.carga_datos_fotospaginacion(Integer.valueOf(this.jtf_paginaactual1.getText().toString()));
}//GEN-LAST:event_jbtn_siguiente1ActionPerformed

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new ventas_sie_diarioventas_detalle().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JScrollPane jScrollPane6;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JButton jbtn_anterior1;
    private javax.swing.JButton jbtn_siguiente1;
    private javax.swing.JEditorPane jep_razon;
    private javax.swing.JEditorPane jepn_fotos;
    private javax.swing.JLabel jlbl_paginas2;
    private javax.swing.JMenuItem jmni_escape;
    private javax.swing.JMenuItem jmni_salir;
    private javax.swing.JTable jtbl_detalleapartado;
    private javax.swing.JTable jtbl_detalledevolucion;
    private javax.swing.JTable jtbl_movimiento;
    private javax.swing.JButton jtbn_clietestadistica;
    private javax.swing.JTextField jtf_agente;
    private javax.swing.JTextField jtf_cliente;
    private javax.swing.JTextField jtf_describepoliticadesc;
    private javax.swing.JTextField jtf_descuento;
    private javax.swing.JTextField jtf_direccion;
    private javax.swing.JTextField jtf_fecha;
    private javax.swing.JTextField jtf_folio;
    private javax.swing.JTextField jtf_folioimpreso;
    private javax.swing.JTextField jtf_folioremision;
    private javax.swing.JTextField jtf_fotosartxpag1;
    private javax.swing.JTextField jtf_iddevolucion;
    private javax.swing.JTextField jtf_paginaactual1;
    private javax.swing.JTextField jtf_piezas;
    private javax.swing.JTextField jtf_politicadesporcentaje;
    private javax.swing.JTextField jtf_status;
    private javax.swing.JTextField jtf_subtotal;
    private javax.swing.JTextField jtf_telefono;
    private javax.swing.JTextField jtf_tienda;
    private javax.swing.JTextField jtf_total;
    // End of variables declaration//GEN-END:variables

}
